<template>
  <div class="topBar">
    叩丁狼电商运营平台
    <i
      class="iconfont product-list topIcon"
      @click="store.commit('updateIsHiddenNav')"
    ></i>
    <el-dropdown class="topDropdown">
      <span class="el-dropdown-link">
        {{ store.state.username
        }}<el-icon class="usernameIcon"><ArrowDownBold /></el-icon>
      </span>
      <template #dropdown>
        <el-dropdown-menu>
          <el-dropdown-item>首页</el-dropdown-item>
          <el-dropdown-item>退出登录</el-dropdown-item>
        </el-dropdown-menu>
      </template>
    </el-dropdown>
  </div>
</template>

<script lang="ts" setup>
import { reactive, toRefs, ref, onMounted } from "vue";
import { ArrowDownBold } from "@element-plus/icons-vue";
import { useStore } from "vuex";
const store = useStore();


</script>
<style lang="less" scoped>
.topBar {
  height: 70px;
  background-color: #409eff;

  padding: 0 20px;
  line-height: 70px;
  font-weight: 400;
  font-size: 24px;
  color: #fff;
  .topIcon {
    vertical-align: middle;
    font-size: 20px;
    margin-left: 10px;
  }
  .topDropdown {
    cursor: pointer;
    top: 50%;
    transform: translate(0, -50%);
    float: right;
    color: white;
  }
  .usernameIcon {
    margin-left: 10px;
  }
}
</style>
